<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.springside.modules.security.springsecurity.SpringSecurityUtils"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Mini-Web 角色管理</title>
		<%@ include file="/common/meta.jsp"%>
		<link href="${staticCtx}/style/yui.css" type="text/css" rel="stylesheet" />
		<link href="${staticCtx}/style/style.css" type="text/css" rel="stylesheet" />
		<script src="${staticCtx}/script/jquery/jquery.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				 $('input.doDelete').bind('click', function(event) {
					if (confirm("确认删除?")){
						  //$('form[name=frm-delete]').submit();
						  $(this).parent().submit();
					}
					
					return false;
				});
			});
		</script>
	</head>

	<body>
		<div id="doc3">
			<%@ include file="/common/header.jsp"%>
			<div id="bd">
				<div id="yui-main">
					<div class="yui-b">
						<div id="filter">
							你好,
							<%=SpringSecurityUtils.getCurrentUserName()%>.
						</div>

						<div id="content">
							<table id="contentTable">
								<tr>
									<th>
										名称
									</th>
									<th>
										授权
									</th>
									<th>
										操作
									</th>
								</tr>

								<c:forEach items="${roleList}" var="role">
									<tr>
										<td>
											${role.name}
										</td>
										<td>
											${role.authNames}
										</td>
										<td>
											&nbsp;
											<security:authorize ifAnyGranted="ROLE_浏览角色">
												<security:authorize ifNotGranted="ROLE_修改角色">
													<a href="${ctx}/account/roles/${role.id}">查看</a>&nbsp;
							</security:authorize>
											</security:authorize>

											<security:authorize ifAnyGranted="ROLE_修改角色">
												<a href="${ctx}/account/roles/${role.id}" id="editLink-${role.name}">修改</a>&nbsp;
												<form:form name="frm-delete" action="${ctx}/account/roles/${role.id}" method="delete">
													<input class="doDelete" type="submit" value="删除" />
												</form:form>
											</security:authorize>
										</td>
									</tr>
								</c:forEach>
							</table>
						</div>

						<div>
							<security:authorize ifAnyGranted="ROLE_修改角色">
								<a href="${ctx}/account/roles/-1">增加新角色</a>
							</security:authorize>
						</div>
					</div>
				</div>
			</div>
			<%@ include file="/common/footer.jsp"%>
		</div>
	</body>
</html>
